//
//  trackDataStatistic.h
//  LAGGeometry
//
//  Created by 罗亮富 on 2018/12/18.
//

#ifndef trackDataStatistic_h
#define trackDataStatistic_h

#include <stdio.h>
#include <MapBasics/LAGGeometry.h>

#ifdef INTERNAL_TEST
#define AUTOPAUSE_TIME_INTERVAL 10 //20 //在设定时间内没有位置更新，就进入自动暂停
#else
#define AUTOPAUSE_TIME_INTERVAL 15
#endif

#define AUTOPAUSE_MINI_SPEED 0.5

#define BURRING_VAL_FOR_ALTIDUDE 20

typedef struct {
    unsigned long count; //统计数量
    double maxSpeed; //最大速度
    double minSpeed; //最小速度
    double totalDistance; //里程
    double burringDistance;//去海拔毛刺总里程
    double goingUp; //累计爬升
    double goingDown; //下降，
    double burringGoingUp; //去海拔毛刺的累计爬升
    double burringGoingDown;//去海拔毛刺的累计下降
    double pauseTime; //暂停时间
    double maxAltitude; //最高海拔
    double minAltitude; //最低海拔
    double southMostLatitude; //最小（南)纬度
    double northMostLatitude; //最大（北)纬度
    double westMostLongitude; //最小（西)经度
    double eastMostLongitude; //最大（东)经度
    
    LocationPointType firstPoint; //第一个点
    LocationPointType lastPoint; //最后一个点
    LocationPointType lastMileageBurringAltitudeBasePoint;//上一个里程海拔去毛刺统计基准点
    LocationPointType lastBurringAltitudeBasePoint;//上一个海拔去毛刺计算基准点
    
    
}LocationPointsSegmentStatisticInfo; //统计信息

//用下面函数创建/设置统计信息
extern LocationPointsSegmentStatisticInfo initSegmentsStatisticsFromPoint(LocationPointType point);
extern void resetSegmentsStatisticsWithPoint(LocationPointsSegmentStatisticInfo *statis,LocationPointType point);
extern void resetSegmentsStatistics(LocationPointsSegmentStatisticInfo *statis);

//轨迹信息统计算法
extern void addPointToStatistics(LocationPointsSegmentStatisticInfo *inStatistics, LocationPointType pointData);

extern double calculatePauseTimeBetweenPoint(LocationPointType p1, LocationPointType p2, double minSpeedThreshold);

#if DEBUG_MODE
extern bool isCoordinateAbnormal(CLLocationCoordinate2D cord);
#endif


#endif /* trackDataStatistic_h */
